﻿using System.Collections.Generic;
using UnityEngine;


namespace HEFramework
{
    /// <summary>
    ///
    /// 资源验证文件工具类
    /// 
    /// ----------------------------------------
    /// 作者 hep
    /// 创建时间：2023-12-21 17:55:39
    /// ----------------------------------------
    /// </summary>
    public class FileCheckList
    {
        /// <summary>
        /// 检查文件数据
        /// </summary>
        public class FileCheckData
        {
            /// <summary>
            /// 象征
            /// </summary>
            public string Symbol { get; set; }

            /// <summary>
            /// 内容字节哈希值
            /// </summary>
            public string Hash { get; set; }

            /// <summary>
            /// 内容字节长度
            /// </summary>
            public int BytesLength { get; set; }


            public FileCheckData(string _symbol, string _hash, int _byteLength)
            {
                Symbol = _symbol;
                Hash = _hash;
                BytesLength = _byteLength;
            }
        }

        /// <summary>
        /// 版本
        /// </summary>
        public int Version { get; set; }

        /// <summary>
        /// 相关信息列表
        /// </summary>
        public List<FileCheckData> Datas { get; set; }

        /// <summary>
        /// 文件名
        /// </summary>
        public string FileName => AssetBundleSettingScriptableObject.Instance.AssetBundleCheckFileName;


        /// <summary>
        /// 创建数据
        /// </summary>
        /// <param name="_length"></param>
        public void CreateData(int _length)
        {
            Datas = new List<FileCheckData>(_length);
        }


        /// <summary>
        /// 添加数据
        /// </summary>
        /// <param name="_data"></param>
        public void AddData(FileCheckData _data)
        {
            if (!Datas.Contains(_data))
            {
                Datas.Add(_data);
            }
        }
    }
}